#!/bin/bash
set -x
sudo yum install nc inotify-tools -y

export LOG_FILE_NAME_EXT=".log"
export LOG_DIR=~/logs
export SERVER_IP=127.0.01
export SERVER_PORT=27015

# 先开启日志
WORK_DIR=`dirname $0`
cd $WORK_DIR
sh stop-logncClient.sh
sh logncClient.sh > /tmp/logncClient.log 2>&1 &

# 开启文件监控，如果产生了新的日志文件，则重新监听新文件内容
while [ 1 ]
do
	inotifywait -e create -e delete -e move "$LOG_DIR"
    sh stop-logncClient.sh
    sh logncClient.sh 2>&1 >> /tmp/logncClient.log &
	sleep 1
done
